import tools from "@/common/tools.js";
import {
	post
} from '@/common/axios.js';
import {
	getuserSquare //广场
} from '@/common/path.js'
export default {
	//用户照片操纵
	namespaced: true,
	state: {
		userInfo: uni.getStorageSync('userInfo'),
		squareList:[] //相册列表
	},
	getters: {

	},
	mutations: {
		SET_LIST(state, data) { //首页广场
			state.squareList = data
		},
	},
	actions: {
		//相册
		getuserSquare({
			dispatch,
			commit,
			state
		}, args={}) {
			post(getuserSquare, args).then(res => {
				if (res.code == 0) {
					if(args.pageNum ==1){
						commit('SET_LIST', res.data)
					}else{
						state.squareList.push(...res.data)
						commit('SET_LIST', state.squareList)
					}
				} else {
					commit('SET_LIST', [])
				}
			})
		}


	},
}
